#include "mainwindow.h"

#include <QApplication>
//#include <QSerialpot>
//#include <QSerialpotInfo>
#include <QInputDialog>
#include "electrolyzerdlg.h"
#include <QString>
#include "sys_config.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    int res;
    int index;
    int size;
    int mode;
    int keep_setting_flag;
    ElectrolyzerDlg dlg;

    dlg.setWindowFlags(dlg.windowFlags() & ~Qt::WindowContextHelpButtonHint);
    res = dlg.exec();
    if (res == QDialog::Accepted) {
        mode = dlg.GetTestMode();
        size = dlg.GetElectrolyzerSize();
        keep_setting_flag = dlg.GetKeepSettingFlag();
        switch (size) {
        case ELECTROLYTIC_STRIP_1: index = 0; break;
        case ELECTROLYTIC_STRIP_2: index = 1; break;
        case ELECTROLYTIC_STRIP_3: index = 2; break;
        case ELECTROLYTIC_STRIP_4: index = 3; break;
        case ELECTROLYTIC_STRIP_5: index = 4; break;
        case ELECTROLYTIC_STRIP_6: index = 5; break;
        case ELECTROLYTIC_STRIP_7: index = 6; break;
        }
        MainWindow w;
        w.SetTestMode(mode);
        w.SetElectrolyzerIndex(index);
        w.SetKeepSettingFlag(keep_setting_flag);
        w.ORP_Enable_Set(dlg.ORP_Enable_Get());
        w.PH_Enable_Set(dlg.PH_Enable_Get());
        w.WaterTemp_Enable_Set(dlg.WaterTemp_Enable_Get());
        w.showMaximized();
        return a.exec();
    }

    return 0;
}

